
matrix orthoProjMatrix;
bool useTexture;
texture destTexture;
float4 elementSize;

sampler textureSampler = sampler_state
{
	Texture = <destTexture>;
	AddressU = CLAMP;
	AddressV = CLAMP;
	AddressW = CLAMP;
	BorderColor = float4(0, 0, 0, 0);
	MipFilter = LINEAR;
	MinFilter = LINEAR;
	MagFilter = LINEAR;
};

struct VertexShaderInput
{
	float3 position : POSITION0;
	float4 color : COLOR0;
	float2 texCoord : TEXCOORD0;
};

struct PixelShaderInput
{
	float4 position : POSITION0;
	float2 texCoord : TEXCOORD0;
	float4 color : TEXCOORD1;
};

void VertexMain(in VertexShaderInput vsInput, out PixelShaderInput output)
{
	output = (PixelShaderInput)0;

	output.position = mul(float4(vsInput.position, 1), orthoProjMatrix);
	output.texCoord = vsInput.texCoord;
	output.color = vsInput.color;
}

void PixelMain(in PixelShaderInput input, out float4 color : COLOR0)
{
	if(useTexture)
		color = tex2D(textureSampler, input.texCoord);
	else
		color = input.color;
}